"use strict";
var render = function() {
  var _vm = this;
  var _h = _vm.$createElement;
  var _c = _vm._self._c || _h;
  return _c("div", { class: ["ele-file-list-item", { checked: _vm.checked }], on: { "click": _vm.itemClick } }, [_c("div", { staticClass: "ele-file-list-item-body" }, [_c("div", { staticClass: "ele-file-list-item-icon" }, [_c("img", { class: { "ele-file-list-item-icon-image": _vm.item && _vm.item.thumbnail }, attrs: { "src": _vm.icon, "alt": _vm.item && _vm.item.name } })]), _c("div", { staticClass: "ele-file-list-item-title ele-text-primary", attrs: { "title": _vm.item && _vm.item.name } }, [_vm._v(" " + _vm._s(_vm.item ? _vm.item.name : "") + " ")])]), _vm.checkbox ? _c("div", { staticClass: "ele-file-list-item-check ele-bg-white", on: { "click": function($event) {
    $event.stopPropagation();
    return _vm.itemCheckChange.apply(null, arguments);
  } } }, [_c("i", { staticClass: "ele-file-icon-check ele-bg-primary" })]) : _vm._e(), _c("div", { staticClass: "ele-file-list-item-bg ele-bg-primary" }), _c("div", { staticClass: "ele-file-list-item-border ele-border-primary" })]);
};
var staticRenderFns = [];
function normalizeComponent(scriptExports, render2, staticRenderFns2, functionalTemplate, injectStyles, scopeId, moduleIdentifier, shadowMode) {
  var options = typeof scriptExports === "function" ? scriptExports.options : scriptExports;
  if (render2) {
    options.render = render2;
    options.staticRenderFns = staticRenderFns2;
    options._compiled = true;
  }
  if (functionalTemplate) {
    options.functional = true;
  }
  if (scopeId) {
    options._scopeId = "data-v-" + scopeId;
  }
  var hook;
  if (moduleIdentifier) {
    hook = function(context) {
      context = context || this.$vnode && this.$vnode.ssrContext || this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext;
      if (!context && typeof __VUE_SSR_CONTEXT__ !== "undefined") {
        context = __VUE_SSR_CONTEXT__;
      }
      if (injectStyles) {
        injectStyles.call(this, context);
      }
      if (context && context._registeredComponents) {
        context._registeredComponents.add(moduleIdentifier);
      }
    };
    options._ssrRegister = hook;
  } else if (injectStyles) {
    hook = shadowMode ? function() {
      injectStyles.call(this, (options.functional ? this.parent : this).$root.$options.shadowRoot);
    } : injectStyles;
  }
  if (hook) {
    if (options.functional) {
      options._injectStyles = hook;
      var originalRender = options.render;
      options.render = function renderWithStyleInjection(h, context) {
        hook.call(context);
        return originalRender(h, context);
      };
    } else {
      var existing = options.beforeCreate;
      options.beforeCreate = existing ? [].concat(existing, hook) : [hook];
    }
  }
  return {
    exports: scriptExports,
    options
  };
}
const __vue2_script = {
  name: "FileGridItem",
  props: {
    item: {
      type: Object,
      required: true
    },
    checkbox: Boolean,
    selection: Array,
    icons: {
      type: Array,
      required: true
    }
  },
  emits: ["item-click", "item-check-change"],
  computed: {
    checked() {
      return this.item && Array.isArray(this.selection) && this.selection.includes(this.item);
    },
    icon() {
      var _a, _b, _c, _d, _e;
      if ((_a = this.item) == null ? void 0 : _a.thumbnail) {
        return this.item.thumbnail;
      }
      if ((_b = this.item) == null ? void 0 : _b.isDirectory) {
        const temp = (_c = this.icons) == null ? void 0 : _c.find((d) => d.type === "dir");
        return temp == null ? void 0 : temp.icon;
      }
      let ic;
      (_d = this.icons) == null ? void 0 : _d.forEach((d) => {
        if (d.types) {
          d.types.forEach((s) => {
            var _a2, _b2;
            if ((_b2 = (_a2 = this.item) == null ? void 0 : _a2.name) == null ? void 0 : _b2.endsWith(s)) {
              ic = d.icon;
            }
          });
        }
      });
      if (!ic) {
        const temp = (_e = this.icons) == null ? void 0 : _e.find((d) => d.type === "file");
        ic = temp == null ? void 0 : temp.icon;
      }
      return ic;
    }
  },
  methods: {
    itemClick() {
      this.$emit("item-click", this.item);
    },
    itemCheckChange() {
      this.$emit("item-check-change", this.item);
    }
  }
};
const __cssModules = {};
var __component__ = /* @__PURE__ */ normalizeComponent(__vue2_script, render, staticRenderFns, false, __vue2_injectStyles, null, null, null);
function __vue2_injectStyles(context) {
  for (let o in __cssModules) {
    this[o] = __cssModules[o];
  }
}
var fileGridItem = /* @__PURE__ */ function() {
  return __component__.exports;
}();
module.exports = fileGridItem;
